//
//  LearnModel.m
//  Cunli
//
//  Created by lilubin on 15/7/6.
//  Copyright (c) 2015年 lilubin. All rights reserved.
//

#import "LearnModel.h"

@implementation LearnModel

/*
 - (void)setAttributes:(NSDictionary *)dataDic
 {
 [super setAttributes:dataDic];
 
 if (dataDic[@"au_or_sper"] != nil) {
 _auOrSper = dataDic[@"au_or_sper"];
 }
 else if(dataDic[@"author"] != nil)
 {
 _auOrSper = dataDic[@"author"];
 }
 else
 {
 _auOrSper = dataDic[@"speaker"];
 }
 }
 */

- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic
{
    if (dic[@"au_or_sper"] != nil) {
        _auOrSper = dic[@"au_or_sper"];
    }
    else if(dic[@"author"] != nil)
    {
        _auOrSper = dic[@"author"];
    }
    else
    {
        _auOrSper = dic[@"speaker"];
    }
    return YES;
}


- (void)setModelType:(LearnModelType)modelType
{
    _modelType = modelType;
    if (modelType == LearnModelTypeAuOrSpeaker)
    {
        if ([_type isEqualToString:@"0"]) {
            _auOrSper = [NSString stringWithFormat:@"作者:%@", _auOrSper];
        }
        else
        {
            _auOrSper = [NSString stringWithFormat:@"主讲人:%@", _auOrSper];
        }
    }
    else
        if(modelType == LearnModelTypeAuthor)
        {
            _auOrSper = [NSString stringWithFormat:@"作者:%@", _auOrSper];
        }
        else
        {
            _auOrSper = [NSString stringWithFormat:@"主讲人:%@", _auOrSper];
        }
}



@end
